package com.markedquilt.mvcframework.pojo;
/*
 * PackageName: com.markedquilt.mvcframework.pojo
 * ClassName:   Handler
 * Author:   coke
 * Date:     Created in 2020/10/22 22:24
 * Description:
 * History:
 * <author>        <time>             <version>          <desc>
 * 作者姓名         修改时间            版本号              描述
 * coke           2020/10/22 22:24     1.0
 */

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.lang.reflect.Method;
import java.util.*;
import java.util.regex.Pattern;

/**
 * @author ZhangKe
 * @Project mvc-demo
 * @Description 封装Handler方法相关信息
 * @date 2020/10/22 22:24.
 */
@Data
@NoArgsConstructor
public class Handler {

    private Object controller;

    private Method method;

    private Pattern pattern;    //存储url

    private Map<String,Integer> paramIndexMapping;  //参数顺序，是为了进行参数绑定，<参数名，第几个参数>

    private List<String> whiteList;

    public Handler(Object controller, Method method, Pattern pattern) {
        this.controller = controller;
        this.method = method;
        this.pattern = pattern;
        this.paramIndexMapping = new HashMap<>();
        this.whiteList = new ArrayList<>();
    }
}
